package com.greentreecs.fms.controller;

import com.greentreecs.fms.pojo.dto.IncDetailRecDTO;
import com.greentreecs.fms.pojo.dto.RoomIncCurveDTO;
import com.greentreecs.fms.pojo.param.QueryIncCurveParam;
import com.greentreecs.fms.pojo.response.GeneralResponse;
import com.greentreecs.fms.service.IncomeCurveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * @author 刀氏春秋
 * @date 2025/6/4
 */
@RequestMapping("/income-curve")
@RestController
@Api(value = "收入曲线获取与分析", tags = "收入曲线获取与分析")
public class IncomeCurveController {
    private final static Logger logger = LoggerFactory.getLogger(IncomeCurveController.class);
    @Autowired
    private IncomeCurveService incomeCurveService;

    @ApiOperation(value = "查询住房收入曲线", notes = "查询住房收入曲线")
    @PostMapping("/query-room-income-curve")
    public GeneralResponse<RoomIncCurveDTO> queryRoomIncomeCurveData(@RequestBody QueryIncCurveParam param) {
        GeneralResponse<RoomIncCurveDTO> response = new GeneralResponse<>();
        try {
            response.fillResponseWith(incomeCurveService.queryRoomIncomeCurveData(param));
        }catch (Exception e) {
            response.fillResponseByException(e);
            logger.error("住房收入曲线查询失败:{}", e.getMessage());
        }
        return response;
    }
}
